﻿using Game;

namespace Mekiasm
{
    public class MetalFormerWidget : BaseEnergyWidget
    {
        public ComponentEnergyMachine Machine;
        public MetalFormerWidget(ComponentEnergyMachine component, ComponentMiner componentMiner) : base(componentMiner)
        {
            Machine = component;
            MekCraftingRecipe.FindCraftDevice(typeof(MetalFomer)).GenerateRecipeWidget(CanvasMain, component, componentMiner, ref Tick);
            setTitle("金属成型机");
        }

        public override void Update()
        {
            Tick?.Invoke();
            SetPowerProgress((float)Machine.Power / (float)Machine.MaxPower);
            SetLeftBottomMoreInfo($"能量消耗:{ILibrary.FormatPowerUse(Machine.OutputPowerLimit)}\n当前储能:{ILibrary.FormatPower(Machine.Power)}\n最大储能:{ILibrary.FormatPower(Machine.MaxPower)}");
        }
    }
}
